package mysql

import "gorm.io/gorm"

type ProductSpecifications struct {
	gorm.Model
	ProductId         int     `gorm:"type:int(10);not null;comment:'商品id'"`
	ProductSpec       string  `gorm:"type:varchar(100);not null;comment:'商品规格'"`
	ProductPackage    string  `gorm:"type:varchar(100);not null;comment:'商品套餐'"`
	ImageSpec         string  `gorm:"type:varchar(100);not null;comment:'商品图片'"`
	SpecCode          string  `gorm:"type:varchar(100);not null;comment:'商品规格码'"`
	RetailPrice       float64 `gorm:"type:double(10,2);not null;comment:'零售价'"`
	CostPrice         float64 `gorm:"type:double(10,2);not null;comment:'成本价'"`
	StockWarningValue int     `gorm:"type:int(10);not null;comment:'库存预警值'"`
	Stock             int     `gorm:"type:int(10);not null;comment:'库存'"`
	Weight            float64 `gorm:"type:double(10,2);not null;comment:'重量/Kg'"`
	SaleVolume        int     `gorm:"type:int(10);not null;comment:'销量'"`
}

func ProductSpecificationsCreate(specifications *ProductSpecifications) error {
	return DB.Debug().Create(&specifications).Error
}
